package me.a_littlesquid.origin.events;

import me.a_littlesquid.origin.Origin;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;


public class peraluse implements Listener {
    private Origin plugin;
    @EventHandler
    public void onUse(PlayerInteractEvent event){
        if(event.hasItem()){
            ItemStack itemStack=event.getItem();
            if (itemStack.getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.GOLD+"无限珍珠")){
                Player player=event.getPlayer();
                PlayerInventory playerInventory=player.getInventory();
                if(itemStack.getAmount()==1) {
                    playerInventory.addItem(itemStack);
                }
            }
        }
    }
}
